]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspacesView: Restore activation of (empty) workspaces
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 1 Dec 2012 00:37:28 +0000 (01:37 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 3 Dec 2012 18:40:29 +0000 (19:40 +0100)
Clicking empty workspaces to leave the overview was broken by
commit 830e701d13, restore the previous behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=689552

js/ui/workspacesView.js

index 95d8ca5809f5100810e9c9a015c06e9f75379709..31322380e0b253dab994823b1999ed6fd023c863 100644 (file)
@@ -444,19 +444,33 @@ const WorkspacesDisplay = new Lang.Class({
         this.actor.connect('allocate', Lang.bind(this, this._allocate));
         this.actor.connect('parent-set', Lang.bind(this, this._parentSet));
         this.actor.set_clip_to_allocation(true);
-        let action = new Clutter.PanAction();
-        action.connect('pan', Lang.bind(this, this._onPan));
-        action.connect('gesture-begin', Lang.bind(this, function() {
+
+        let clickAction = new Clutter.ClickAction()
+        clickAction.connect('clicked', Lang.bind(this, function(action) {
+            // Only switch to the workspace when there's no application
+            // windows open. The problem is that it's too easy to miss
+            // an app window and get the wrong one focused.
+            if (action.get_button() == 1 &&
+                this._getPrimaryView().getActiveWorkspace().isEmpty())
+                Main.overview.hide();
+        }));
+        Main.overview.addAction(clickAction);
+        this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
+
+        let panAction = new Clutter.PanAction();
+        panAction.connect('pan', Lang.bind(this, this._onPan));
+        panAction.connect('gesture-begin', Lang.bind(this, function() {
             for (let i = 0; i < this._workspacesViews.length; i++)
                 this._workspacesViews[i].startSwipeScroll();
             return true;
         }));
-        action.connect('gesture-end', Lang.bind(this, function() {
+        panAction.connect('gesture-end', Lang.bind(this, function() {
+            clickAction.release();
             for (let i = 0; i < this._workspacesViews.length; i++)
                 this._workspacesViews[i].endSwipeScroll();
         }));
-        Main.overview.addAction(action);
-        this.actor.bind_property('mapped', action, 'enabled', GObject.BindingFlags.SYNC_CREATE);
+        Main.overview.addAction(panAction);
+        this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
 
         let controls = new St.Bin({ style_class: 'workspace-controls',
                                     request_mode: Clutter.RequestMode.WIDTH_FOR_HEIGHT,